*------------------------------------------------------------------------------
* (1) Aggregatbetrachtungen 
*  Parteien B/L
*------------------------------------------------------------------------------


		

putexcel set "tables\aggregate_development_party_cand.xlsx", sheet(party) replace

putexcel A2 = "NDS: W5"
putexcel A3 = "NDS: W6"
putexcel A4 = "NDS: W7"
putexcel A5 = "NDS: W8"
putexcel A6 = "NDS: W9"
putexcel A7 = "BTW: W5"
putexcel A8 = "BTW: W6"
putexcel A9 = "BTW: W7"
putexcel A10 = "BTW: W8"
putexcel A11 = "BTW:  W9"

//Columns
putexcel B1 = "CDU"
putexcel C1 = "SPD"
putexcel D1 = "FDP"
putexcel E1 = "Grüne"
putexcel F1 = "Linke"
putexcel G1 = "AfD"
putexcel I1 = "N"		


//Formatting
putexcel A1:A11, right border(right) overwritefmt
putexcel A1:I1, hcenter bold border(bottom) overwritefmt
putexcel I1:I11, hcenter bold border(left, double) 



local zeile 1
		foreach wave of numlist 5/9 {
		local zeile = `zeile'+1
		
		mean L_scalcdu`wave'	L_scalspd`wave'	
		
		putexcel B`zeile' = matrix(e(b)), nformat(number_d2)  
		putexcel I`zeile' = `e(N)'
	}

		foreach wave of numlist 5/9 {
		local zeile = `zeile'+1
		
		mean B_scalcdu`wave'	B_scalspd`wave'	
		
		putexcel B`zeile' = matrix(e(b)), nformat(number_d2)   
		putexcel I`zeile' = `e(N)'
	}

*------------------------------------------------------------------------------
* (1) Aggregatbetrachtungen 
*  Kandidaten B/L
*------------------------------------------------------------------------------


putexcel set "tables\aggregate_development_party_cand.xlsx", sheet(cand) modify

putexcel A2 = "NDS: W5"
putexcel A3 = "NDS: W6"
putexcel A4 = "NDS: W7"
putexcel A5 = "NDS: W8"
putexcel A6 = "NDS: W9"
putexcel A7 = "BTW: W5"
putexcel A8 = "BTW: W6"
putexcel A9 = "BTW: W7"
putexcel A10 = "BTW: W8"
putexcel A11 = "BTW:  W9"

//Columns
putexcel B1 = "CDU"
putexcel C1 = "SPD"
putexcel D1 = "FDP"
putexcel E1 = "Grüne"
putexcel F1 = "Linke"
putexcel G1 = "AfD"
putexcel I1 = "N"		


//Formatting
putexcel A1:A11, right border(right) overwritefmt
putexcel A1:I1, hcenter bold border(bottom) overwritefmt
putexcel I1:I11, hcenter bold border(left, double) 



local zeile 1
		foreach wave of numlist 5/9 {
		local zeile = `zeile'+1
		
		mean L_candcdu`wave'	L_candspd`wave'		
		
		putexcel B`zeile' = matrix(e(b)), nformat(number_d2)  
		putexcel I`zeile' = `e(N)'
	}

		foreach wave of numlist 5/9 {
		local zeile = `zeile'+1
		
		mean B_candcdu`wave'	B_candspd`wave'	
		
		putexcel B`zeile' = matrix(e(b)), nformat(number_d2)   
		putexcel I`zeile' = `e(N)'
	}

